#ifndef TESTFUNCTIONS_H
#define TESTFUNCTIONS_H

class QString;

#include <string>
#include <vector>

enum class MSG_TYPE{
  DEBUG,
  INFO,
  WARN,
  ERROR
};

inline std::string Hex2Ascii(uint8_t* bytes, size_t count) {
  std::string cipher_text_hex(count * 2, '\0');
  for(int i = 0; i < count; i++) {
    sprintf(cipher_text_hex.data() + i *2, "%02x", bytes[i]);
  }
  return std::move(cipher_text_hex);
}

void Ascii2Hex(const std::string& hex_str,
        std::vector<uint8_t>& hex_array);


void printInfo(const char* format, ...);
void printError(const char* format, ...);
void printFormatedMessage(const QString& msg,
                          MSG_TYPE type = MSG_TYPE::INFO);


// crypto test
void TestHash();
void TestProvider();
void TestBigNumber();
void TestBase64();
void TestCert(const char* path);

// digest test
void TestSM3();
void TestSha256();


// ssl test
void TestSSLHandshake();


// symmetric algorithms
void TestSM4();
void TestAES128();
void TestSM4GCM();

// asymmetric algorithms
void TestSM2();
void TestRSA();
void TestDSA();
void TestECC();

// PKI TEST
void TestPKI12();
void TestPKI11(const std::string& lib_path,
               const std::string& pin);
void TestSKF(const std::string& lib_path,
             const std::string& pin);


namespace boost_test {
void TestSignal();
void TestIOService();
void TestHttpClient();
}



#endif // TESTFUNCTIONS_H
